<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">

<html lang="en">

<head>
  <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
  <title>LCOV - self_test2.info - network_io/unix/inet_pton.c</title>
  <link rel="stylesheet" type="text/css" href="../../gcov.css">
</head>

<body>

  <table width="100%" border=0 cellspacing=0 cellpadding=0>
    <tr><td class="title">LCOV - code coverage report</td></tr>
    <tr><td class="ruler"><img src="../../glass.png" width=3 height=3 alt=""></td></tr>

    <tr>
      <td width="100%">
        <table cellpadding=1 border=0 width="100%">
          <tr>
            <td width="10%" class="headerItem">Current view:</td>
            <td width="35%" class="headerValue"><a href="../../index.html">top level</a> - <a href="index.html">network_io/unix</a> - inet_pton.c<span style="font-size: 80%;"> (source / <a href="inet_pton.c.func.html">functions</a>)</span></td>
            <td width="5%"></td>
            <td width="15%"></td>
            <td width="10%" class="headerCovTableHead">Hit</td>
            <td width="10%" class="headerCovTableHead">Total</td>
            <td width="15%" class="headerCovTableHead">Coverage</td>
          </tr>
          <tr>
            <td class="headerItem">Test:</td>
            <td class="headerValue">self_test2.info</td>
            <td></td>
            <td class="headerItem">Lines:</td>
            <td class="headerCovTableEntry">75</td>
            <td class="headerCovTableEntry">82</td>
            <td class="headerCovTableEntryHi">91.5 %</td>
          </tr>
          <tr>
            <td class="headerItem">Date:</td>
            <td class="headerValue">2011-07-03</td>
            <td></td>
            <td class="headerItem">Functions:</td>
            <td class="headerCovTableEntry">3</td>
            <td class="headerCovTableEntry">3</td>
            <td class="headerCovTableEntryHi">100.0 %</td>
          </tr>
          <tr>
            <td></td>
            <td></td>
            <td></td>
            <td class="headerItem">Branches:</td>
            <td class="headerCovTableEntry">49</td>
            <td class="headerCovTableEntry">61</td>
            <td class="headerCovTableEntryMed">80.3 %</td>
          </tr>
          <tr><td><img src="../../glass.png" width=3 height=3 alt=""></td></tr>
        </table>
      </td>
    </tr>

    <tr><td class="ruler"><img src="../../glass.png" width=3 height=3 alt=""></td></tr>
  </table>

  <table cellpadding=0 cellspacing=0 border=0>
    <tr>
      <td><br></td>
    </tr>
    <tr>
      <td>
<pre class="sourceHeading">           Branch data     Line data    Source code</pre>
<pre class="source">
<a name="1"><span class="lineNum">       1 </span>                :            : /* Copyright (c) 1996 by Internet Software Consortium.</a>
<span class="lineNum">       2 </span>                :            :  *
<span class="lineNum">       3 </span>                :            :  * Permission to use, copy, modify, and distribute this software for any
<span class="lineNum">       4 </span>                :            :  * purpose with or without fee is hereby granted, provided that the above
<span class="lineNum">       5 </span>                :            :  * copyright notice and this permission notice appear in all copies.
<span class="lineNum">       6 </span>                :            :  *
<span class="lineNum">       7 </span>                :            :  * THE SOFTWARE IS PROVIDED &quot;AS IS&quot; AND INTERNET SOFTWARE CONSORTIUM DISCLAIMS
<span class="lineNum">       8 </span>                :            :  * ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES
<span class="lineNum">       9 </span>                :            :  * OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL INTERNET SOFTWARE
<span class="lineNum">      10 </span>                :            :  * CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
<span class="lineNum">      11 </span>                :            :  * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
<span class="lineNum">      12 </span>                :            :  * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
<span class="lineNum">      13 </span>                :            :  * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
<span class="lineNum">      14 </span>                :            :  * SOFTWARE.
<span class="lineNum">      15 </span>                :            :  */
<span class="lineNum">      16 </span>                :            : 
<span class="lineNum">      17 </span>                :            : #include &quot;apr_private.h&quot;
<span class="lineNum">      18 </span>                :            : #include &quot;apr_arch_networkio.h&quot;
<span class="lineNum">      19 </span>                :            : 
<span class="lineNum">      20 </span>                :            : #if APR_HAVE_SYS_TYPES_H
<span class="lineNum">      21 </span>                :            : #include &lt;sys/types.h&gt;
<span class="lineNum">      22 </span>                :            : #endif
<span class="lineNum">      23 </span>                :            : #if APR_HAVE_SYS_SOCKET_H
<span class="lineNum">      24 </span>                :            : #include &lt;sys/socket.h&gt;
<span class="lineNum">      25 </span>                :            : #endif
<span class="lineNum">      26 </span>                :            : #if APR_HAVE_NETINET_IN_H
<span class="lineNum">      27 </span>                :            : #include &lt;netinet/in.h&gt;
<span class="lineNum">      28 </span>                :            : #endif
<span class="lineNum">      29 </span>                :            : #if APR_HAVE_ARPA_INET_H
<span class="lineNum">      30 </span>                :            : #include &lt;arpa/inet.h&gt;
<span class="lineNum">      31 </span>                :            : #endif
<span class="lineNum">      32 </span>                :            : #include &lt;string.h&gt;
<span class="lineNum">      33 </span>                :            : #if APR_HAVE_ERRNO_H
<span class="lineNum">      34 </span>                :            : #include &lt;errno.h&gt;
<span class="lineNum">      35 </span>                :            : #endif
<span class="lineNum">      36 </span>                :            : 
<span class="lineNum">      37 </span>                :            : #ifndef IN6ADDRSZ
<span class="lineNum">      38 </span>                :            : #define IN6ADDRSZ   16
<span class="lineNum">      39 </span>                :            : #endif
<span class="lineNum">      40 </span>                :            : 
<span class="lineNum">      41 </span>                :            : #ifndef INT16SZ
<span class="lineNum">      42 </span>                :            : #define INT16SZ sizeof(apr_int16_t)
<span class="lineNum">      43 </span>                :            : #endif
<span class="lineNum">      44 </span>                :            : 
<span class="lineNum">      45 </span>                :            : #ifndef INADDRSZ
<span class="lineNum">      46 </span>                :            : #define INADDRSZ    4
<span class="lineNum">      47 </span>                :            : #endif
<span class="lineNum">      48 </span>                :            : 
<span class="lineNum">      49 </span>                :            : #ifndef __P
<span class="lineNum">      50 </span>                :            : #define __P(x) x
<span class="lineNum">      51 </span>                :            : #endif
<span class="lineNum">      52 </span>                :            : 
<span class="lineNum">      53 </span>                :            : #if !defined(EAFNOSUPPORT) &amp;&amp; defined(WSAEAFNOSUPPORT)
<span class="lineNum">      54 </span>                :            : #define EAFNOSUPPORT WSAEAFNOSUPPORT
<span class="lineNum">      55 </span>                :            : #endif
<span class="lineNum">      56 </span>                :            : 
<span class="lineNum">      57 </span>                :            : /*
<span class="lineNum">      58 </span>                :            :  * WARNING: Don't even consider trying to compile this on a system where
<span class="lineNum">      59 </span>                :            :  * sizeof(int) &lt; 4.  sizeof(int) &gt; 4 is fine; all the world's not a VAX.
<span class="lineNum">      60 </span>                :            :  */
<span class="lineNum">      61 </span>                :            : 
<span class="lineNum">      62 </span>                :            : static int      inet_pton4 __P((const char *src, unsigned char *dst));
<span class="lineNum">      63 </span>                :            : #if APR_HAVE_IPV6
<span class="lineNum">      64 </span>                :            : static int      inet_pton6 __P((const char *src, unsigned char *dst));
<span class="lineNum">      65 </span>                :            : #endif
<span class="lineNum">      66 </span>                :            : 
<span class="lineNum">      67 </span>                :            : /* int
<span class="lineNum">      68 </span>                :            :  * inet_pton(af, src, dst)
<span class="lineNum">      69 </span>                :            :  *      convert from presentation format (which usually means ASCII printable)
<span class="lineNum">      70 </span>                :            :  *      to network format (which is usually some kind of binary format).
<span class="lineNum">      71 </span>                :            :  * return:
<span class="lineNum">      72 </span>                :            :  *      1 if the address was valid for the specified address family
<span class="lineNum">      73 </span>                :            :  *      0 if the address wasn't valid (`dst' is untouched in this case)
<span class="lineNum">      74 </span>                :            :  *      -1 if some other error occurred (`dst' is untouched in this case, too)
<span class="lineNum">      75 </span>                :            :  * author:
<span class="lineNum">      76 </span>                :            :  *      Paul Vixie, 1996.
<span class="lineNum">      77 </span>                :            :  */
<a name="78"><span class="lineNum">      78 </span>                :            : int</a>
<span class="lineNum">      79 </span>                :            : apr_inet_pton(int af, const char *src, void *dst)
<span class="lineNum">      80 </span>                :<span class="lineCov">         97 : {</span>
<span class="lineNum">      81 </span>     [<span class="branchCov" title="Branch 0 was taken 48 times"> + </span><span class="branchCov" title="Branch 1 was taken 49 times"> + </span><span class="branchNoCov" title="Branch 2 was not taken"> - </span>]:<span class="lineCov">         97 :         switch (af) {</span>
<span class="lineNum">      82 </span>                :            :         case AF_INET:
<span class="lineNum">      83 </span>                :<span class="lineCov">         48 :                 return (inet_pton4(src, dst));</span>
<span class="lineNum">      84 </span>                :            : #if APR_HAVE_IPV6
<span class="lineNum">      85 </span>                :            :         case AF_INET6:
<span class="lineNum">      86 </span>                :<span class="lineCov">         49 :                 return (inet_pton6(src, dst));</span>
<span class="lineNum">      87 </span>                :            : #endif
<span class="lineNum">      88 </span>                :            :         default:
<span class="lineNum">      89 </span>                :<span class="lineNoCov">          0 :                 errno = EAFNOSUPPORT;</span>
<span class="lineNum">      90 </span>                :<span class="lineCov">         97 :                 return (-1);</span>
<span class="lineNum">      91 </span>                :            :         }
<span class="lineNum">      92 </span>                :            :         /* NOTREACHED */
<span class="lineNum">      93 </span>                :            : }
<span class="lineNum">      94 </span>                :            : 
<span class="lineNum">      95 </span>                :            : /* int
<span class="lineNum">      96 </span>                :            :  * inet_pton4(src, dst)
<span class="lineNum">      97 </span>                :            :  *      like inet_aton() but without all the hexadecimal and shorthand.
<span class="lineNum">      98 </span>                :            :  * return:
<span class="lineNum">      99 </span>                :            :  *      1 if `src' is a valid dotted quad, else 0.
<span class="lineNum">     100 </span>                :            :  * notice:
<span class="lineNum">     101 </span>                :            :  *      does not touch `dst' unless it's returning 1.
<span class="lineNum">     102 </span>                :            :  * author:
<span class="lineNum">     103 </span>                :            :  *      Paul Vixie, 1996.
<span class="lineNum">     104 </span>                :            :  */
<a name="105"><span class="lineNum">     105 </span>                :            : static int</a>
<span class="lineNum">     106 </span>                :            : inet_pton4(const char *src, unsigned char *dst)
<span class="lineNum">     107 </span>                :<span class="lineCov">         81 : {</span>
<span class="lineNum">     108 </span>                :            :     static const char digits[] = &quot;0123456789&quot;;
<span class="lineNum">     109 </span>                :            :     int saw_digit, octets, ch;
<span class="lineNum">     110 </span>                :            :     unsigned char tmp[INADDRSZ], *tp;
<span class="lineNum">     111 </span>                :            : 
<span class="lineNum">     112 </span>                :<span class="lineCov">         81 :     saw_digit = 0;</span>
<span class="lineNum">     113 </span>                :<span class="lineCov">         81 :     octets = 0;</span>
<span class="lineNum">     114 </span>                :<span class="lineCov">         81 :     *(tp = tmp) = 0;</span>
<span class="lineNum">     115 </span>        [<span class="branchCov" title="Branch 0 was taken 746 times"> + </span><span class="branchCov" title="Branch 1 was taken 71 times"> + </span>]:<span class="lineCov">        817 :     while ((ch = *src++) != '\0') {</span>
<span class="lineNum">     116 </span>                :            :         const char *pch;
<span class="lineNum">     117 </span>                :            : 
<span class="lineNum">     118 </span>[<span class="branchNoCov" title="Branch 1 was not taken"> - </span><span class="branchCov" title="Branch 2 was taken 746 times"> + </span>][<span class="branchCov" title="Branch 5 was taken 533 times"> + </span><span class="branchCov" title="Branch 6 was taken 213 times"> + </span>]:<span class="lineCov">        746 :         if ((pch = strchr(digits, ch)) != NULL) {</span>
<span class="lineNum">     119 </span>                :<span class="lineCov">        533 :             unsigned int new = *tp * 10 + (unsigned int)(pch - digits);</span>
<span class="lineNum">     120 </span>                :            : 
<span class="lineNum">     121 </span>        [<span class="branchCov" title="Branch 0 was taken 3 times"> + </span><span class="branchCov" title="Branch 1 was taken 530 times"> + </span>]:<span class="lineCov">        533 :             if (new &gt; 255)</span>
<span class="lineNum">     122 </span>                :<span class="lineCov">          3 :                 return (0);</span>
<span class="lineNum">     123 </span>                :<span class="lineCov">        530 :             *tp = new;</span>
<span class="lineNum">     124 </span>        [<span class="branchCov" title="Branch 0 was taken 284 times"> + </span><span class="branchCov" title="Branch 1 was taken 246 times"> + </span>]:<span class="lineCov">        530 :             if (! saw_digit) {</span>
<span class="lineNum">     125 </span>        [<span class="branchNoCov" title="Branch 0 was not taken"> - </span><span class="branchCov" title="Branch 1 was taken 284 times"> + </span>]:<span class="lineCov">        284 :                 if (++octets &gt; 4)</span>
<span class="lineNum">     126 </span>                :<span class="lineNoCov">          0 :                     return (0);</span>
<span class="lineNum">     127 </span>                :<span class="lineCov">        284 :                 saw_digit = 1;</span>
<span class="lineNum">     128 </span>                :            :             }
<span class="lineNum">     129 </span>        [<span class="branchCov" title="Branch 0 was taken 210 times"> + </span><span class="branchCov" title="Branch 1 was taken 3 times"> + </span>]:<span class="lineCov">        213 :         } else if (ch == '.' &amp;&amp; saw_digit) {</span>
<span class="lineNum">     130 </span>        [<span class="branchCov" title="Branch 0 was taken 4 times"> + </span><span class="branchCov" title="Branch 1 was taken 206 times"> + </span>]:<span class="lineCov">        210 :             if (octets == 4)</span>
<span class="lineNum">     131 </span>                :<span class="lineCov">          4 :                 return (0);</span>
<span class="lineNum">     132 </span>                :<span class="lineCov">        206 :             *++tp = 0;</span>
<span class="lineNum">     133 </span>                :<span class="lineCov">        206 :             saw_digit = 0;</span>
<span class="lineNum">     134 </span>                :            :         } else
<span class="lineNum">     135 </span>                :<span class="lineCov">          3 :                 return (0);</span>
<span class="lineNum">     136 </span>                :            :     }
<span class="lineNum">     137 </span>        [<span class="branchCov" title="Branch 0 was taken 10 times"> + </span><span class="branchCov" title="Branch 1 was taken 61 times"> + </span>]:<span class="lineCov">         71 :     if (octets &lt; 4)</span>
<span class="lineNum">     138 </span>                :<span class="lineCov">         10 :         return (0);</span>
<span class="lineNum">     139 </span>                :            : 
<span class="lineNum">     140 </span>                :            :     memcpy(dst, tmp, INADDRSZ);
<span class="lineNum">     141 </span>                :<span class="lineCov">         81 :     return (1);</span>
<span class="lineNum">     142 </span>                :            : }
<span class="lineNum">     143 </span>                :            : 
<span class="lineNum">     144 </span>                :            : #if APR_HAVE_IPV6
<span class="lineNum">     145 </span>                :            : /* int
<span class="lineNum">     146 </span>                :            :  * inet_pton6(src, dst)
<span class="lineNum">     147 </span>                :            :  *      convert presentation level address to network order binary form.
<span class="lineNum">     148 </span>                :            :  * return:
<span class="lineNum">     149 </span>                :            :  *      1 if `src' is a valid [RFC1884 2.2] address, else 0.
<span class="lineNum">     150 </span>                :            :  * notice:
<span class="lineNum">     151 </span>                :            :  *      (1) does not touch `dst' unless it's returning 1.
<span class="lineNum">     152 </span>                :            :  *      (2) :: in a full address is silently ignored.
<span class="lineNum">     153 </span>                :            :  * credit:
<span class="lineNum">     154 </span>                :            :  *      inspired by Mark Andrews.
<span class="lineNum">     155 </span>                :            :  * author:
<span class="lineNum">     156 </span>                :            :  *      Paul Vixie, 1996.
<span class="lineNum">     157 </span>                :            :  */
<a name="158"><span class="lineNum">     158 </span>                :            : static int</a>
<span class="lineNum">     159 </span>                :            : inet_pton6(const char *src, unsigned char *dst)
<span class="lineNum">     160 </span>                :<span class="lineCov">         49 : {</span>
<span class="lineNum">     161 </span>                :            :         static const char xdigits_l[] = &quot;0123456789abcdef&quot;,
<span class="lineNum">     162 </span>                :            :                           xdigits_u[] = &quot;0123456789ABCDEF&quot;;
<span class="lineNum">     163 </span>                :            :         unsigned char tmp[IN6ADDRSZ], *tp, *endp, *colonp;
<span class="lineNum">     164 </span>                :            :         const char *xdigits, *curtok;
<span class="lineNum">     165 </span>                :            :         int ch, saw_xdigit;
<span class="lineNum">     166 </span>                :            :         unsigned int val;
<span class="lineNum">     167 </span>                :            : 
<span class="lineNum">     168 </span>                :<span class="lineCov">         49 :         memset((tp = tmp), '\0', IN6ADDRSZ);</span>
<span class="lineNum">     169 </span>                :<span class="lineCov">         49 :         endp = tp + IN6ADDRSZ;</span>
<span class="lineNum">     170 </span>                :<span class="lineCov">         49 :         colonp = NULL;</span>
<span class="lineNum">     171 </span>                :            :         /* Leading :: requires some special handling. */
<span class="lineNum">     172 </span>        [<span class="branchCov" title="Branch 0 was taken 3 times"> + </span><span class="branchCov" title="Branch 1 was taken 46 times"> + </span>]:<span class="lineCov">         49 :         if (*src == ':')</span>
<span class="lineNum">     173 </span>        [<span class="branchNoCov" title="Branch 0 was not taken"> - </span><span class="branchCov" title="Branch 1 was taken 3 times"> + </span>]:<span class="lineCov">          3 :                 if (*++src != ':')</span>
<span class="lineNum">     174 </span>                :<span class="lineNoCov">          0 :                         return (0);</span>
<span class="lineNum">     175 </span>                :<span class="lineCov">         49 :         curtok = src;</span>
<span class="lineNum">     176 </span>                :<span class="lineCov">         49 :         saw_xdigit = 0;</span>
<span class="lineNum">     177 </span>                :<span class="lineCov">         49 :         val = 0;</span>
<span class="lineNum">     178 </span>        [<span class="branchCov" title="Branch 0 was taken 213 times"> + </span><span class="branchCov" title="Branch 1 was taken 16 times"> + </span>]:<span class="lineCov">        229 :         while ((ch = *src++) != '\0') {</span>
<span class="lineNum">     179 </span>                :            :                 const char *pch;
<span class="lineNum">     180 </span>                :            : 
<span class="lineNum">     181 </span>[<span class="branchNoCov" title="Branch 1 was not taken"> - </span><span class="branchCov" title="Branch 2 was taken 213 times"> + </span>][<span class="branchCov" title="Branch 5 was taken 63 times"> + </span><span class="branchCov" title="Branch 6 was taken 150 times"> + </span>]:<span class="lineCov">        213 :                 if ((pch = strchr((xdigits = xdigits_l), ch)) == NULL)</span>
<span class="lineNum">     182 </span>        [<span class="branchNoCov" title="Branch 1 was not taken"> - </span><span class="branchCov" title="Branch 2 was taken 63 times"> + </span>]:<span class="lineCov">         63 :                         pch = strchr((xdigits = xdigits_u), ch);</span>
<span class="lineNum">     183 </span>        [<span class="branchCov" title="Branch 0 was taken 153 times"> + </span><span class="branchCov" title="Branch 1 was taken 60 times"> + </span>]:<span class="lineCov">        213 :                 if (pch != NULL) {</span>
<span class="lineNum">     184 </span>                :<span class="lineCov">        153 :                         val &lt;&lt;= 4;</span>
<span class="lineNum">     185 </span>                :<span class="lineCov">        153 :                         val |= (pch - xdigits);</span>
<span class="lineNum">     186 </span>        [<span class="branchNoCov" title="Branch 0 was not taken"> - </span><span class="branchCov" title="Branch 1 was taken 153 times"> + </span>]:<span class="lineCov">        153 :                         if (val &gt; 0xffff)</span>
<span class="lineNum">     187 </span>                :<span class="lineNoCov">          0 :                                 return (0);</span>
<span class="lineNum">     188 </span>                :<span class="lineCov">        153 :                         saw_xdigit = 1;</span>
<span class="lineNum">     189 </span>                :<span class="lineCov">        153 :                         continue;</span>
<span class="lineNum">     190 </span>                :            :                 }
<span class="lineNum">     191 </span>        [<span class="branchCov" title="Branch 0 was taken 27 times"> + </span><span class="branchCov" title="Branch 1 was taken 33 times"> + </span>]:<span class="lineCov">         60 :                 if (ch == ':') {</span>
<span class="lineNum">     192 </span>                :<span class="lineCov">         27 :                         curtok = src;</span>
<span class="lineNum">     193 </span>        [<span class="branchCov" title="Branch 0 was taken 14 times"> + </span><span class="branchCov" title="Branch 1 was taken 13 times"> + </span>]:<span class="lineCov">         27 :                         if (!saw_xdigit) {</span>
<span class="lineNum">     194 </span>        [<span class="branchNoCov" title="Branch 0 was not taken"> - </span><span class="branchCov" title="Branch 1 was taken 14 times"> + </span>]:<span class="lineCov">         14 :                                 if (colonp)</span>
<span class="lineNum">     195 </span>                :<span class="lineNoCov">          0 :                                         return (0);</span>
<span class="lineNum">     196 </span>                :<span class="lineCov">         14 :                                 colonp = tp;</span>
<span class="lineNum">     197 </span>                :<span class="lineCov">         14 :                                 continue;</span>
<span class="lineNum">     198 </span>                :            :                         }
<span class="lineNum">     199 </span>        [<span class="branchNoCov" title="Branch 0 was not taken"> - </span><span class="branchCov" title="Branch 1 was taken 13 times"> + </span>]:<span class="lineCov">         13 :                         if (tp + INT16SZ &gt; endp)</span>
<span class="lineNum">     200 </span>                :<span class="lineNoCov">          0 :                                 return (0);</span>
<span class="lineNum">     201 </span>                :<span class="lineCov">         13 :                         *tp++ = (unsigned char) (val &gt;&gt; 8) &amp; 0xff;</span>
<span class="lineNum">     202 </span>                :<span class="lineCov">         13 :                         *tp++ = (unsigned char) val &amp; 0xff;</span>
<span class="lineNum">     203 </span>                :<span class="lineCov">         13 :                         saw_xdigit = 0;</span>
<span class="lineNum">     204 </span>                :<span class="lineCov">         13 :                         val = 0;</span>
<span class="lineNum">     205 </span>                :<span class="lineCov">         13 :                         continue;</span>
<span class="lineNum">     206 </span>                :            :                 }
<span class="lineNum">     207 </span>[<span class="branchCov" title="Branch 0 was taken 33 times"> + </span><span class="branchNoCov" title="Branch 1 was not taken"> - </span>][<span class="branchCov" title="Branch 2 was taken 33 times"> + </span><span class="branchNoCov" title="Branch 3 was not taken"> - </span>]:<span class="lineCov">         33 :                 if (ch == '.' &amp;&amp; ((tp + INADDRSZ) &lt;= endp) &amp;&amp;</span>
<span class="lineNum">         </span>        [<span class="branchCov" title="Branch 5 was taken 29 times"> + </span><span class="branchCov" title="Branch 6 was taken 4 times"> + </span>]
<span class="lineNum">     208 </span>                :            :                     inet_pton4(curtok, tp) &gt; 0) {
<span class="lineNum">     209 </span>                :<span class="lineCov">         29 :                         tp += INADDRSZ;</span>
<span class="lineNum">     210 </span>                :<span class="lineCov">         29 :                         saw_xdigit = 0;</span>
<span class="lineNum">     211 </span>                :<span class="lineCov">         29 :                         break;  /* '\0' was seen by inet_pton4(). */</span>
<span class="lineNum">     212 </span>                :            :                 }
<span class="lineNum">     213 </span>                :<span class="lineCov">          4 :                 return (0);</span>
<span class="lineNum">     214 </span>                :            :         }
<span class="lineNum">     215 </span>        [<span class="branchCov" title="Branch 0 was taken 11 times"> + </span><span class="branchCov" title="Branch 1 was taken 34 times"> + </span>]:<span class="lineCov">         45 :         if (saw_xdigit) {</span>
<span class="lineNum">     216 </span>        [<span class="branchNoCov" title="Branch 0 was not taken"> - </span><span class="branchCov" title="Branch 1 was taken 11 times"> + </span>]:<span class="lineCov">         11 :                 if (tp + INT16SZ &gt; endp)</span>
<span class="lineNum">     217 </span>                :<span class="lineNoCov">          0 :                         return (0);</span>
<span class="lineNum">     218 </span>                :<span class="lineCov">         11 :                 *tp++ = (unsigned char) (val &gt;&gt; 8) &amp; 0xff;</span>
<span class="lineNum">     219 </span>                :<span class="lineCov">         11 :                 *tp++ = (unsigned char) val &amp; 0xff;</span>
<span class="lineNum">     220 </span>                :            :         }
<span class="lineNum">     221 </span>        [<span class="branchCov" title="Branch 0 was taken 14 times"> + </span><span class="branchCov" title="Branch 1 was taken 31 times"> + </span>]:<span class="lineCov">         45 :         if (colonp != NULL) {</span>
<span class="lineNum">     222 </span>                :            :                 /*
<span class="lineNum">     223 </span>                :            :                  * Since some memmove()'s erroneously fail to handle
<span class="lineNum">     224 </span>                :            :                  * overlapping regions, we'll do the shift by hand.
<span class="lineNum">     225 </span>                :            :                  */
<span class="lineNum">     226 </span>                :<span class="lineCov">         14 :                 const apr_ssize_t n = tp - colonp;</span>
<span class="lineNum">     227 </span>                :            :                 apr_ssize_t i;
<span class="lineNum">     228 </span>                :            : 
<span class="lineNum">     229 </span>        [<span class="branchCov" title="Branch 0 was taken 22 times"> + </span><span class="branchCov" title="Branch 1 was taken 14 times"> + </span>]:<span class="lineCov">         36 :                 for (i = 1; i &lt;= n; i++) {</span>
<span class="lineNum">     230 </span>                :<span class="lineCov">         22 :                         endp[- i] = colonp[n - i];</span>
<span class="lineNum">     231 </span>                :<span class="lineCov">         22 :                         colonp[n - i] = 0;</span>
<span class="lineNum">     232 </span>                :            :                 }
<span class="lineNum">     233 </span>                :<span class="lineCov">         14 :                 tp = endp;</span>
<span class="lineNum">     234 </span>                :            :         }
<span class="lineNum">     235 </span>        [<span class="branchCov" title="Branch 0 was taken 31 times"> + </span><span class="branchCov" title="Branch 1 was taken 14 times"> + </span>]:<span class="lineCov">         45 :         if (tp != endp)</span>
<span class="lineNum">     236 </span>                :<span class="lineCov">         31 :                 return (0);</span>
<span class="lineNum">     237 </span>                :            :         memcpy(dst, tmp, IN6ADDRSZ);
<span class="lineNum">     238 </span>                :<span class="lineCov">         49 :         return (1);</span>
<span class="lineNum">     239 </span>                :            : }
<span class="lineNum">     240 </span>                :            : #endif
</pre>
      </td>
    </tr>
  </table>
  <br>

  <table width="100%" border=0 cellspacing=0 cellpadding=0>
    <tr><td class="ruler"><img src="../../glass.png" width=3 height=3 alt=""></td></tr>
    <tr><td class="versionInfo">Generated by: <a href="http://ltp.sourceforge.net/coverage/lcov.php" target="_parent">LCOV version 1.9</a></td></tr>
  </table>
  <br>

</body>
</html>
